package com.learner.ucenter.controller.api;

import com.learner.pojo.user.FeedBack;
import com.learner.pojo.user.vo.FeedBackResultVo;
import com.learner.ucenter.service.FeedBackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author linweibing
 * @date 2023-03-28 19:44
 * @description: TODO
 */
@Slf4j
@RequestMapping("/api/ucenter/feedBack")
@RestController
public class FeedBackController {

    @Autowired
    FeedBackService feedBackService;

    /**
     * 新增反馈
     *
     * @param feedBack feedBack
     */
    @PostMapping("")
    public void addFeedBack(@RequestBody FeedBack feedBack) {
        log.info("反馈请求参数为：" + feedBack);
        feedBackService.addFeedBack(feedBack);
    }

    /**
     * 获取反馈记录列表
     *
     * @return 结果
     */
    @GetMapping("/list")
    public List<FeedBackResultVo> getFeedbackList() {
        return feedBackService.getFeedbackList();
    }
}
